<template>
	<view class="">
		<view class="box">
			<view class="content">
				<view class="c-tit">期望职位</view>
				<input type="text" value="" v-model="form.exp_job" placeholder="请输入期望职位" placeholder-style="font-size: 36rpx; color:#BFBFBF;" style="font-size: 36rpx;" />
			</view>
			<view class="content">
				<view class="c-tit">求职地区</view>
				<area2 style="font-size: 36rpx;" :p_id="form.exp_province_id" :c_id="form.exp_area_id" @back_func_op="b1"></area2>
				<!-- <view class="c-cont">
					<area2 style="font-size: 36rpx;" :p_id="form.exp_province_id" :c_id="form.exp_area_id" @back_func_op="b1"></area2>
					<view class="c-view">选择</view>
				</view> -->
			</view>
			<view class="content">
				<view class="c-tit">期望薪资</view>
				<view class="c-cont" @click="showSaly=true">
					<input type="text" value="" v-model="form.exp_salary_type_name" placeholder="请选择期望薪资" placeholder-style="font-size: 36rpx; color:#BFBFBF;" style="font-size: 36rpx;" />
					<view class="c-view">选择</view>
				</view>
			</view>
			<view class="content">
				<view class="c-tit">到职时间</view>
				<view class="c-cont" @click="showTime=true">
					<input type="text" disabled="true" value="" v-model="form.exp_job_in_time" placeholder="请选择到职时间" placeholder-style="font-size: 36rpx; color:#BFBFBF;" style="font-size: 36rpx;" />
					<view class="c-view">选择</view>
				</view>
			</view>
			<view class="content">
				<view class="c-tit">工作性质</view>
				<view class="c-cont" @click="showWork=true">
					<input type="text" value="" v-model="form.exp_work_type_name" placeholder="请选择工资性质" placeholder-style="font-size: 36rpx; color:#BFBFBF;" style="font-size: 36rpx;" />
					<view class="c-view">选择</view>
				</view>
			</view>
		</view>
		<u-calendar v-model="showTime" :mode="mode" @change="change" max-date="2100-01-01"></u-calendar>
		<u-select mode="single-column" v-model="showSaly" :list="list" @confirm="confirm"></u-select>
		<u-select mode="single-column" v-model="showWork" :list="listt" @confirm="confirmm"></u-select>
		<view class="dl" @click="baocun">
			<view class="dll">保存</view>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import area2 from '@/pages/my/enterprise/area'
	export default{
		components:{
			area2
		},
		data(){
			return{
				form:{},
				list:[],
				listt:[],
				mode: 'date',
				showSaly:false,
				showWork:false,
				showTime: false,
				exp_work_type:'',
				exp_salary_type:'',
			}
		},
		created() {
			let self=this;
			uni.getStorage({
			    key: 'stateData',
			    success: function (res) {
			        self.stateData=res.data
					console.log(self.stateData,"静态数据")
					self.jt()
			    }
				
			});
		},
		onLoad() {
			this.chakan()
		},
		methods:{
			async chakan(){
				const res=await this.post('/Index/User/get_user_exp')
				if(res.code==200){
					this.form=res.data
					this.salary_range_type=res.data.exp_job_in_time;
					this.exp_work_type=res.data.exp_work_type;
				}
				console.log(res)
			},
			async baocun(){
				// this.form.exp_area_id=1;
				const res=await this.post('/Index/User/save_exp',this.form)
				if(res.code==200){
					this.$refs.uToast.show({
						title: '成功',
						type: 'success',
					})
					uni.navigateBack({
						
					})
				}
			},
			change(e) {
				console.log(e);
				this.form.exp_job_in_time = e.result;
			},
			jt(){
				for(let i in this.stateData.salary_range_type){
					this.list.push({value:i,label:this.stateData.salary_range_type[i]})
				}
				for(let i in this.stateData.exp_work_type){
					this.listt.push({value:i,label:this.stateData.exp_work_type[i]})
				}
			},
			confirm(e){
				console.log(e)
				this.form.exp_salary_type=e[0].value;
				this.form.exp_salary_type_name=e[0].label;
			},
			confirmm(e){
				console.log(e)
				this.form.exp_work_type=e[0].value;
				this.form.exp_work_type_name=e[0].label;
			},
			b1(e){
				console.log("b1:")
				console.log(e)
				this.form.exp_area_id=e.c_id
				this.form.exp_province_id=e.p_id
			},
		}
	}
</script>

<style lang="scss" scoped>
	.dl {
		width: 80%;
		padding: 30rpx;
		position: fixed;
		bottom: 10rpx;
		left: 50%;
		transform: translateX(-50%);
		.dll {
			width: 100%;
			height: 90rpx;
			color: #FFFFFF;
			font-size: 36rpx;
			line-height: 90rpx;
			text-align: center;
			border-radius: 15rpx;
			background-color: #3291F8;
		}
	}
	.box {
		padding: 30rpx;
		box-sizing: border-box;
	}
	.content {
		// display: flex;
		// align-items: center;
		// justify-content: space-between;
		border-bottom: 1rpx solid #bcbcbc;
		padding: 20rpx 0;
		.c-tit{
			color: #101010;
			font-size: 32rpx;
			margin-bottom: 15rpx;
		}
		.c-cont{
			display: flex;
			align-items: center;
			justify-content: space-between;
			.c-view{
				color: #3291F8;
				font-size: 36rpx;
			}
		}
	}
	
</style>
